最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

python如何下載指定版本TensorFlow

 更新時(shí)間:2024年03月28日 08:37:25   作者:灬點(diǎn)點(diǎn)  
這篇文章主要介紹了python如何下載指定版本TensorFlow問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

一、python安裝與下載依賴

依賴版本

TensorFlow>=2.3.0
Keras  >= 2.4.3 
Numpy < 1.19.0
Pandas >= 1.1.0
scikit-learn >= 0.23.2
librosa >=0.8.0
scipy==1.4.1

依賴下載

TensorFlow>=2.3.0 pip3 install tensorflow-cpu==2.3.0 -i https://pypi.douban.com/simple/
Keras >= 2.4.3 pip3 install Keras==2.4.3 -i https://pypi.douban.com/simple/
Pandas >= 1.1.0 pip3 install Pandas==1.1.0 -i https://pypi.douban.com/simple/
scikit-learn >= 0.23.2 pip3 install scikit-learn==0.23.2 -i https://pypi.douban.com/simple/
librosa >=1.19.1 pip3 install librosa==0.8.0 -i https://pypi.douban.com/simple/
scipy==1.4.1 pip3 install scipy==1.4.1 -i https://pypi.douban.com/simple/ 

安裝python3

yum -y install gcc
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel
wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
tar -zxvf Python-3.7.3.tgz
mkdir /usr/local/python3
cd Python-3.7.3
./configure --prefix=/usr/local/python3
make && make install
ln -sf /usr/local/python3/bin/python3.7 /usr/bin/python3
ln -sf /usr/local/python3/bin/pip3.7 /usr/bin/pip3

驗(yàn)證

pip3 list

pip3升級(jí)

pip3 --default-timeout=10000 install -U pip

pip3 卸載與安裝

  • pip3 install 包名 例如:pip3 install Pandas
  • pip3 uninstall 包名 例如: pip3 uninstall Pandas

二、mybatis plus 樂觀鎖配置

import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * mybatis plus 樂觀鎖配置
 * @author nick
 */
@EnableTransactionManagement
@Configuration
public class MybatisPlusConfig {
    /**
     *   樂觀鎖
     */
    @Bean
    public OptimisticLockerInterceptor optimisticLockerInterceptor() {
        return new OptimisticLockerInterceptor();
    }
}

三、@Scheduled定時(shí)任務(wù)升級(jí)分布式定時(shí)任務(wù)

/**
 * DisSchedule切面
 */
@Order(100)
@Aspect
@Slf4j
public class DisScheduleAspect {

	public static final String SERVER_NAME = "serverName";

	private final IDisScheduleService disScheduleService;

	private final String serverName;

	public DisScheduleAspect(
		IDisScheduleService disScheduleService,
		Environment environment) {
		Preconditions.checkNotNull(disScheduleService);
		this.disScheduleService = disScheduleService;
		Preconditions.checkNotNull(environment);
		String serverName = environment.getProperty(SERVER_NAME);
		Preconditions.checkArgument(!Strings.isNullOrEmpty(serverName));
		this.serverName = serverName;
	}

	/**
	 * 方法上有注解SaveLog
	 */
	@Pointcut(value = "@annotation(com.citydo.xclouddesk.interceptor.annotation.DisSchedule)")
	public void disScheduleAnnotation() {
	}

	@Around(value = "disScheduleAnnotation() && @annotation(disSchedule)")
	public Object disSchedule(ProceedingJoinPoint joinPoint, DisSchedule disSchedule) throws Throwable {
		Preconditions.checkNotNull(disSchedule);
		// 當(dāng)前時(shí)間
		Date curDate = TimeUtil.getCurDate();
		// 獲取name
		String name = disSchedule.name();
		if (Strings.isNullOrEmpty(name)) {
			// 方法名
			Signature signature = joinPoint.getSignature();
			name = signature.getName();
		}
		// 時(shí)間間隔
		int duration = disSchedule.duration();
		if (duration <= 0) {
			log.error(
				"disSchedule fail, duration {} is less or equal 0, name : {}",
				duration,
				name
			);
			return null;
		}
		// 時(shí)間間隔的單位
		TimeUnit unit = disSchedule.unit().getUnit();
		// 轉(zhuǎn)化為毫秒
		long millis = unit.toMillis(duration);
		// 獲取當(dāng)前任務(wù)所屬的開始時(shí)間
		Date taskDate = TimeUtil.getMillisDate(curDate, (int) millis);
		// 當(dāng)前服務(wù)是否屬于線上服務(wù)
		if (!disScheduleService.serverNameIsValid(serverName)) {
			log.info(
				"disSchedule fail, serverName is invalid, serverName : {} , name : {} , taskDate : {}",
				serverName,
				name,
				TimeUtil.specialFormatToDateStr(taskDate)
			);
			return null;
		}
		if (!disScheduleService.tryGetLock(name, taskDate, serverName)) {
			log.info(
				"Distributed lock not acquired, name : {} , taskDate : {}",
				name,
				TimeUtil.specialFormatToDateStr(taskDate)
			);
			return null;
		}
		// 執(zhí)行正常的方法邏輯
		return joinPoint.proceed();
	}
}
/**
 * 在方法執(zhí)行之前,決定當(dāng)前是否需要執(zhí)行定時(shí)調(diào)度任務(wù)
 * @author nick
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface DisSchedule {

	/**
	 * 定時(shí)調(diào)度任務(wù)的名稱(默認(rèn)是方法名)
	 */
	String name() default "";

	/**
	 * 任務(wù)的間隔時(shí)間
	 */
	int duration();

	/**
	 * duration的時(shí)間單位(默認(rèn):分鐘)
	 */
	DisScheduleUnit unit() default DisScheduleUnit.MINUTES;
}
/**
 * 分布式定時(shí)調(diào)度服務(wù)
 * @author nick
 */
public interface IDisScheduleService {

	/**
	 * 重新加載
	 */
	void reload();

	/**
	 * serverName是否有效
	 */
	boolean serverNameIsValid(String serverName);

	/**
	 * 嘗試獲取鎖
	 */
	boolean tryGetLock(String taskName, Date taskDate, String serverName);

	/**
	 * 添加當(dāng)前的serverName
	 */
	void addServerName(String serverName);

	/**
	 * 移除當(dāng)前的serverName
	 */
	void removeServerName(String serverName);
}

/**
 * redis實(shí)現(xiàn)
 */
@Slf4j
@Service
public class DisScheduleRedisServiceImpl implements IDisScheduleService {

	public static final String DIS_SCHEDULE_SERVER_NAME = "disScheduleServerName";

	private final IRedisManager redisManager;

	public DisScheduleRedisServiceImpl(IRedisManager redisManager) {
		Preconditions.checkNotNull(redisManager);
		this.redisManager = redisManager;
	}

	@Override
	public void reload() {
		// do nothing
	}

	@Override
	public boolean serverNameIsValid(String serverName) {
		try {
			return redisManager.isMember(DIS_SCHEDULE_SERVER_NAME, serverName);
		} catch (Exception e) {
			log.error(
				"DisScheduleRedisServiceImpl-serverNameIsValid fail, serverName : {} , exception : {}",
				serverName,
				e
			);
		}
		return false;
	}

	@Override
	public boolean tryGetLock(String taskName, Date taskDate, String serverName) {
		try {
			return redisManager.setNx(
				taskName + "_" + TimeUtil.specialFormatToDateStr(taskDate),
				serverName
			);
		} catch (Exception e) {
			log.error(
				"DisScheduleRedisServiceImpl-tryGetLock fail, taskName : {} , taskDate : {} , serverName : {} , exception : {}",
				taskName,
				TimeUtil.specialFormatToDateStr(taskDate),
				serverName,
				e
			);
		}

		return false;
	}

	@Override
	public void addServerName(String serverName) {
		Preconditions.checkArgument(!Strings.isNullOrEmpty(serverName));
		redisManager.sAdd(DIS_SCHEDULE_SERVER_NAME, serverName);
	}

	@Override
	public void removeServerName(String serverName) {
		Preconditions.checkArgument(!Strings.isNullOrEmpty(serverName));
		redisManager.sRem(DIS_SCHEDULE_SERVER_NAME, serverName);
	}


//  @DisSchedule(name = "testSchedule", duration = 1, unit = DisScheduleUnit.MINUTES)
//  @Scheduled(cron = "0 0/1 * * * ?")
//  public void testSchedule() {
//	logger.info("輸出");
//  }
}
public interface IRedisManager {


	/**
	 * 向set中添加元素
	 */
	boolean sAdd(String key, String value);

	/**
	 * set中是否存在value
	 */
	boolean isMember(String key, String value);

	/**
	 * 移除set中的元素
	 */
	void sRem(String key, String value);


	/**
	 * 設(shè)置字符串的值(如果不存在的話)
	 */
	boolean setNx(String key, String value);
}
/**
 * 基于jedis實(shí)現(xiàn)的redisManager
 */
@Service
public class JedisManagerImpl implements IRedisManager {

	@Autowired
	private JedisPoolClient jedisPoolClient;

	/**
	 * 返回1說明添加成功,返回0說明已經(jīng)存在
	 * @param key
	 * @param value
	 * @return
	 */
	@Override
	public boolean sAdd(String key, String value) {
		Preconditions.checkArgument(!Strings.isNullOrEmpty(key));
		Preconditions.checkArgument(!Strings.isNullOrEmpty(value));
		return jedisPoolClient.sAdd(key, value) == 1L;
	}

	@Override
	public boolean isMember(String key, String value) {
		Preconditions.checkArgument(!Strings.isNullOrEmpty(key));
		Preconditions.checkArgument(!Strings.isNullOrEmpty(value));
		return jedisPoolClient.isMember(key, value);
	}

	@Override
	public void sRem(String key, String value) {
		Preconditions.checkArgument(!Strings.isNullOrEmpty(key));
		Preconditions.checkArgument(!Strings.isNullOrEmpty(value));
		jedisPoolClient.sRem(key, value);
	}

	@Override
	public boolean setNx(String key, String value) {
		Preconditions.checkArgument(!Strings.isNullOrEmpty(key));
		Preconditions.checkArgument(!Strings.isNullOrEmpty(value));
		return jedisPoolClient.setNX(key, value);
	}
}

參考:https://github.com/death00/dis-schedule

四、Multiset與HashMap、Multimap關(guān)系

在這里插入圖片描述

總結(jié)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • pandas獲取某列最大值的所有數(shù)據(jù)的兩種方法

    pandas獲取某列最大值的所有數(shù)據(jù)的兩種方法

    本文主要介紹了pandas獲取某列最大值的所有數(shù)據(jù)實(shí)現(xiàn)示例,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2024-07-07
  • pytorch環(huán)境配置及安裝圖文詳解(包括anaconda的安裝)

    pytorch環(huán)境配置及安裝圖文詳解(包括anaconda的安裝)

    這篇文章主要介紹了pytorch環(huán)境配置及安裝圖文詳解(包括anaconda的安裝),本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2023-04-04
  • Python列表去重的9種方法終極指南

    Python列表去重的9種方法終極指南

    在Python開發(fā)中,列表去重是一個(gè)常見需求,尤其當(dāng)需要保留元素原始順序時(shí),本文為大家詳細(xì)介紹了Python列表去重的9種方法,感興趣的小伙伴可以了解下
    2025-11-11
  • 基于打開pycharm有帶圖片md文件卡死問題的解決

    基于打開pycharm有帶圖片md文件卡死問題的解決

    這篇文章主要介紹了基于打開pycharm有帶圖片md文件卡死問題的解決,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2020-04-04
  • 使用python-cv2實(shí)現(xiàn)Harr+Adaboost人臉識(shí)別的示例

    使用python-cv2實(shí)現(xiàn)Harr+Adaboost人臉識(shí)別的示例

    這篇文章主要介紹了使用python-cv2實(shí)現(xiàn)Harr+Adaboost人臉識(shí)別的示例,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-10-10
  • 用Python編寫一個(gè)簡(jiǎn)單的俄羅斯方塊游戲的教程

    用Python編寫一個(gè)簡(jiǎn)單的俄羅斯方塊游戲的教程

    這篇文章主要介紹了用Python編寫一個(gè)簡(jiǎn)單的俄羅斯方塊游戲的教程,編寫俄羅斯方塊幾乎是每門編程語言基礎(chǔ)學(xué)習(xí)后的必備實(shí)踐,需要的朋友可以參考下
    2015-04-04
  • python 將有序數(shù)組轉(zhuǎn)換為二叉樹的方法

    python 將有序數(shù)組轉(zhuǎn)換為二叉樹的方法

    這篇文章主要介紹了python 將有序數(shù)組轉(zhuǎn)換為二叉樹的方法,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-03-03
  • Python?Pandas數(shù)據(jù)分析的使用完整教學(xué)

    Python?Pandas數(shù)據(jù)分析的使用完整教學(xué)

    本文介紹了高效數(shù)據(jù)處理的全流程技術(shù)方案,涵蓋數(shù)據(jù)接入、診斷、清洗、轉(zhuǎn)換及時(shí)序分析五大環(huán)節(jié),文中的示例代碼講解詳細(xì),有需要的小伙伴可以了解下
    2026-06-06
  • python?ast模塊詳析與用法

    python?ast模塊詳析與用法

    這篇文章主要給大家介紹了關(guān)于python?ast模塊詳析與用法的相關(guān)資料, Python的ast(Abstract Syntax Trees,抽象語法樹)模塊是一個(gè)內(nèi)置模塊,用于解析Python代碼并生成語法樹,需要的朋友可以參考下
    2023-07-07
  • Python稀疏矩陣scipy.sparse包使用詳解

    Python稀疏矩陣scipy.sparse包使用詳解

    本文主要介紹了Python稀疏矩陣scipy.sparse包使用詳解,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-02-02

最新評(píng)論

西乡县| 高要市| 雅安市| 昭觉县| 湖北省| 麦盖提县| 临沧市| 新干县| 仁化县| 禄丰县| 井冈山市| 泰安市| 汉寿县| 永寿县| 丁青县| 洱源县| 望城县| 宁晋县| 白水县| 屯门区| 蛟河市| 菏泽市| 彭泽县| 桂东县| 大厂| 肇庆市| 和平区| 呼和浩特市| 沈丘县| 东兰县| 田东县| 太和县| 成安县| 大英县| 中超| 遵义市| 固始县| 马关县| 涟水县| 丹巴县| 泸州市|