我正在尝试安装Postgis以便在OSX上使用GeoDjango.
为此,我首先完全卸载了postgres,然后按照GeoDjango文档安装了所有内容:https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#homebrew
我做了以下事情:
brew update
brew upgrade
brew install postgresql
brew install postgis
brew install gdal
brew install libgeoip
Run Code Online (Sandbox Code Playgroud)
当我运行我的Django项目时,我收到以下错误:
OSError at / dlopen(/usr/local/lib/libgeos_c.so, 6): image not found
Run Code Online (Sandbox Code Playgroud)
我跑了
sudo find . -name "libgeos_c*"
Run Code Online (Sandbox Code Playgroud)
得到了:
./Library/Frameworks/GEOS.framework/Versions/3/unix/lib/libgeos_c.dylib
./Users/martin/opt/geos-3.3.0/capi/.deps/libgeos_c_la-geos_c.Plo
./Users/martin/opt/geos-3.3.0/capi/.deps/libgeos_c_la-geos_ts_c.Plo
./usr/local/Cellar/geos/3.3.3/lib/libgeos_c.1.dylib
./usr/local/Cellar/geos/3.3.3/lib/libgeos_c.a
./usr/local/Cellar/geos/3.3.3/lib/libgeos_c.dylib
./usr/local/Cellar/geos/3.3.4/lib/libgeos_c.1.dylib
./usr/local/Cellar/geos/3.3.4/lib/libgeos_c.a
./usr/local/Cellar/geos/3.3.4/lib/libgeos_c.dylib
./usr/local/Cellar/geos/3.3.5/lib/libgeos_c.1.dylib
./usr/local/Cellar/geos/3.3.5/lib/libgeos_c.a
./usr/local/Cellar/geos/3.3.5/lib/libgeos_c.dylib
./usr/local/lib/libgeos_c.1.dylib
./usr/local/lib/libgeos_c.a
./usr/local/lib/libgeos_c.dylib
Run Code Online (Sandbox Code Playgroud)
如您所见,根本没有".so"文件.有什么建议?
编辑:
出于绝望,我还安装了KyngChaos包并添加了以下设置:
GEOS_LIBRARY_PATH = '/Library/Frameworks/GEOS.framework/GEOS'
GDAL_LIBRARY_PATH = '/Library/Frameworks/GDAL.framework/GDAL'
GEOIP_LIBRARY_PATH = '/usr/local/Cellar/geoip/1.4.8/lib/libGeoIP.dylib'
Run Code Online (Sandbox Code Playgroud)
这解决了这个问题.
我想在我的大型python项目中列出所有字符串.
想象一下在python中创建字符串的不同可能性:
mystring = "hello world"
mystring = ("hello "
"world")
mystring = "hello " \
"world"
Run Code Online (Sandbox Code Playgroud)
我需要一个工具,为我项目中的每个字符串输出"filename,linenumber,string".使用"\"或"('')"分布在多行上的字符串应显示在一行中.
有什么想法可以做到这一点?
我从官方网站下载了PostgreSQL并运行了.dmg安装程序.之后我下载了pgadmin3,我确实能够连接到数据库.
当我运行'psql'时,我收到以下错误:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
Run Code Online (Sandbox Code Playgroud)
经过几个小时的谷歌搜索,我读到了一些$ PATH问题,所以我把它放到我的.bashrc中:
export PATH=/Library/PostgreSQL/9.1/bin:$PATH
Run Code Online (Sandbox Code Playgroud)
但是,这根本不能解决上述错误.经过几个小时的谷歌搜索,我试图运行'psql -l localhost -U postgres'.这给出了另一个错误:
psql: could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection …Run Code Online (Sandbox Code Playgroud) 我喜欢使用这些命令来查看服务器上的内存使用情况:
ps -u $USERNAME -o pid,rss,command | awk '{print $0}{sum+=$2} END {print "Total", sum}'
Run Code Online (Sandbox Code Playgroud)
在 Python 脚本中收集总和的最佳方法是什么?我查看了 psutil,但该模块仅收集全局内存信息,并且无法按用户过滤它。